

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Template Substitution Macros [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Code Template,Code Template Syntax, Template Substitution Macros,Macro,Macro Template Substitution, Code Template Syntax">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Template Substitution Macros</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="macros.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="fieldsubstitutionmacros.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText" style="font-style: italic;">Template substitution</span><span class="f_BodyText"> macros correspond to <a href="basetemplates.htm">Base templates</a>. These macros result in the execution of the named template. By convention, template macros are named according to Pascal casing.</span></p>
<p class="p_BodyText"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_BodyText" style="font-style: italic;">Structure: %&lt;TemplateName&gt;%</span></p>
<p class="p_BodyText"><span class="f_BodyText">where &lt;</span><span class="f_BodyText" style="font-style: italic;">TemplateName</span><span class="f_BodyText">&gt; can be one of the templates listed below.</span></p>
<p class="p_BodyText"><span class="f_BodyText">When a template is referenced from within another template, it is generated with respect to the elements currently in scope. The specific template is selected based on the stereotypes of the elements in scope.</span></p>
<p class="p_BodyText"><span class="f_BodyText">As noted previously, there is an implicit hierarchy among the various templates. Some care should be taken in order to preserve a sensible hierarchy of template references. For example, it does not make sense to use the </span><span class="f_BodyText" style="font-style: italic;">%ClassInherits%</span><span class="f_BodyText"> macro within any of the attribute or operation templates. Conversely, the </span><span class="f_BodyText" style="font-style: italic;">Operation</span><span class="f_BodyText"> and </span><span class="f_BodyText" style="font-style: italic;">Attribute</span><span class="f_BodyText"> templates are designed for use within the </span><span class="f_BodyText" style="font-style: italic;">ClassBody</span><span class="f_BodyText"> template.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The CTF contains the following template substitution macros:</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="0" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">AttributeDeclaration</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassParameter</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">NamespaceBody</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">AttributeNotes</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">File</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">NamespaceDeclaration</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">Attribute</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">FileImpl</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">NamespaceImpl</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">Class</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ImportSection</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">Operation</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassImpl</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ImportSectionImpl</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationBody</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassBase</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">InnerClass</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationBodyImpl</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassBody</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">InnerClassImpl</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationDeclaration</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassBodyImpl</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">LinkedAttribute</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationDeclarationImpl</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassDeclaration</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">LinkedAttributeNotes</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationImpl</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassDeclarationImpl</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">LinkedAttributeDeclaration</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">OperationNotes</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassInherits</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">LinkedClassBase</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">Parameter</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassInterface</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">LinkedClassInterface</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="214" style="width:214px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">ClassNotes</span></li>
</ul>
</td>
<td valign="top" width="211" style="width:211px;"><ul style="text-indent: 0px; margin-left: 15px; list-style-position: outside;">
<li><span class="f_Tabletext">Namespace</span></li>
</ul>
</td>
<td valign="top" width="243" style="width:243px;"><p class="p_Tabletext"><span class="f_Tabletext">&nbsp;</span></p>
</td>
</tr>
</table>
</div>




            </div>
          </div>
        </div>



</div>


</body>
</html>
